{{extend "layout_admin.html"}}

{{block css}}
<link href="{{=url_for_static('bootstrap-datepicker/css/datepicker3.css')}}" rel="stylesheet">
<link href="{{=url_for_static('sb-admin-v2/css/plugins/dataTables/dataTables.bootstrap.css')}}" rel="stylesheet">
{{end}}

{{block title}}
<i class="fa fa-bug fa-fw"></i> BUG 管理
{{end}}

{{block content}}
<div class="row">
    <div class="col-lg-12">
        <form class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-lg-1 control-label">BUG ID:</label>
                <div class="col-lg-2">
                    <input type="number" class="form-control" placeholder="ID" id="txt-bug-id">
                </div>

                <label class="col-lg-1 control-label">BUG 标题:</label>
                <div class="col-lg-2">
                    <input type="text" class="form-control" placeholder="标题" id="txt-bug-title">
                </div>

                <label class="col-lg-1 control-label">更新时间:</label>
                <div class="col-lg-4">
                    <div class="input-daterange input-group" id="bug-datepicker">
                        <input type="text" class="input-sm form-control" id="start-date" />
                        <span class="input-group-addon">~</span>
                        <input type="text" class="input-sm form-control" id="end-date" />
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg-1 control-label">所属项目:</label>
                <div class="col-lg-2">
                    <select class="form-control" id="sel-project">
                        <option value="0">所有项目</option>
                        {{for p in projects:}}
                        <option value="{{=p.id}}">{{=p.name}}</option>
                        {{pass}}
                    </select>
                </div>

                <label class="col-lg-1 control-label">BUG性质:</label>
                <div class="col-lg-2">
                    <select class="form-control" id="sel-importance">
                        <option value="0">所有性质</option>
                        {{for i in importances:}}
                        <option value="{{=i.code}}">{{=i.name}}</option>
                        {{pass}}
                    </select>
                </div>

                <label class="col-lg-1 control-label">BUG状态:</label>
                <div class="col-lg-2">
                    <select class="form-control" id="sel-state">
                        <option value="0">所有状态</option>
                        {{for s in states:}}
                        <option value="{{=s.code}}">{{=s.name}}</option>
                        {{pass}}
                    </select>
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-offset-1">
                    <button type="button" class="btn btn-primary btn-lg" id="btn-search">
                        <span class="fa fa-search"></span> 检索</button>
                    <button type="reset" class="btn btn-default">
                        <span class="fa fa-eraser"></span> 清除</button>
                </div>
            </div>
        </form>
    </div>
</div>
<hr>
<table class="table table-striped table-bordered table-hover" id="dt-bugs">
    <thead>
        <tr>
            <th>#ID</th>
            <th>BUG标题</th>
            <th>所属项目</th>
            <th>BUG状态</th>
            <th>BUG性质</th>
            <th>更新时间</th>
            <th>创建者</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

{{end}}

{{block js}}
<script src="{{=url_for_static('chujue-js/chujue_ajax.js')}}"></script>
<script src="{{=url_for_static('sb-admin-v2/js/plugins/dataTables/jquery.dataTables.js')}}"></script>
<script src="{{=url_for_static('sb-admin-v2/js/plugins/dataTables/dataTables.bootstrap.js')}}"></script>
<script src="{{=url_for_static('bootstrap-datepicker/js/bootstrap-datepicker.js')}}"></script>
<script src="{{=url_for_static('bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js')}}"></script>

<script src="{{=url_for_static('views_bug_admin/list.js')}}"></script>
<script type="text/javascript">
    $(function(){
        $("#bug-datepicker").datepicker({
            language: "zh-CN",
            autoclose: true,
            todayBtn: "linked",
            todayHighlight: true,
        });

        $("#btn-search").click(search_bugs);

        init_datatable();
    });
</script>
{{end}}
